<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>纹理贴图</title>
    <script src="./js/three.js"></script>
</head>
<body>

</body>
<script>

    var scene = new THREE.Scene();
    var camera = new THREE.OrthographicCamera(-3,3,4,-4,1,100);
    camera.position.set(3,4,5);
    camera.lookAt(new THREE.Vector3(0,0,0));

    var renderer = new THREE.WebGLRenderer();
    renderer.setSize(window.innerWidth, window.innerHeight);

    document.body.appendChild(renderer.domElement);

    // light
    var light = new THREE.PointLight(0xffffff, 1, 1000);
    light.position.set(10, 15, 20);
    scene.add(light);

    var texture = THREE.ImageUtils.loadTexture('./img/zero.png', {} ,function () {
        // 绘制，否则一片黑
        renderer.render(scene,camera);
    });

    var cube = new THREE.Mesh(new THREE.CubeGeometry(2,2,2),
        new THREE.MeshLambertMaterial({
            map : texture
        }));

    scene.add(camera);
    scene.add(cube);

    // 渲染
    renderer.render(scene, camera);


</script>
</html>